import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testcase = "dbshop017-添加属性组"

firefox = openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,"商品管理","商品属性","属性分组")

# 点击 添加属性组
firefox.find_element_by_xpath('//a[contains(.,"添加属性组")]').click()
time.sleep(5)
firefox.find_element_by_id("attribute_group_name").send_keys(attributeGroupName)
firefox.find_element_by_id("attribute_group_sort").clear()
firefox.find_element_by_id("attribute_group_sort").send_keys(1)
# 点击保存
firefox.find_element_by_xpath('//button[contains(.,"保存属性组信息")]').click()
time.sleep(5)

# 断言
try:
    firefox.find_element_by_xpath('//td[contains(.,"%s")]'%(attributeGroupName)).is_displayed()
    writeLog("%s 测试通过"%testcase)
except:
    writeLog("%s 测试失败" % testcase)
    getPhoto(firefox)
# firefox.quit()